package com.gthncz.beans;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class LifeCircleBean implements InitializingBean, DisposableBean {

	private String msg;

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	/**
	 * implement of InitializingBean
	 */
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println(" run on afterPropertiesSet ... ");
		System.out.println("Msg on afterPropertiesSet: " + this.msg);
	}

	/**
	 * implement of DisposableBean
	 */
	@Override
	public void destroy() throws Exception {
		System.out.println(" run on destroy ... ");
		System.out.println("Msg on destroy: " + this.msg);
	}
	
	/**
	 * implement of init-method which definite in xml
	 */
	public void xml_initialize() {
		System.out.println(" run on xml_initialize ... ");
		System.out.println("Msg on xml_initialize: " + this.msg);
	}
	
	/**
	 * implement of destroy-method which definite in xml
	 */
	public void xml_destroy() {
		System.out.println(" run on xml_destroy ... ");
		System.out.println("Msg on xml_destroy: " + this.msg);
	}

}
